package middle.ground.core.consts;


/**
 * 启用或禁用状态枚举
 *
 * @author jrl
 * @author jrl
 * @date 2020-12-01
 */
public enum EnableOrDisable {

	/**
	 * 启用
	 */
	ENABLE("1", "启用"),

	/**
	 * 禁用
	 */
	DISABLE("0", "禁用");

	private String code;
	private String value;

	EnableOrDisable(String code, String value) {
		this.code = code;
		this.value = value;
	}

	public String getValue() {
		return this.value;
	}

	public String getCode() {
		return this.code;
	}

	/**
	 * 根据code获取对应的枚举
	 *
	 * @param code
	 * @return
	 */
	public static EnableOrDisable valueOfCode(String code) {
		for (EnableOrDisable obj : EnableOrDisable.values()) {
			if (obj.code.equals(code)) {
				return obj;
			}
		}

		return null;
	}
}
